﻿<?php
ob_start();
//valid access
define('_VALID_NVB','1');
//include some files
require_once("conf.php");
require( "lib/mySQL.php" );
require( "lib/class.Template.inc.php" );
require( "lib/topost.php" );
require( "lib/link_pass.php" );
require("conf.php");
//Database
$DB = new db_driver;
//Database
$DB->obj['sql_database']     = $config['dbname'];
//Username
$DB->obj['sql_user']         = $config['username'];
//Password
$DB->obj['sql_pass']         = $config['password'];
//Host. VD: localhost
$DB->obj['sql_host']         = $config['host'];
// Get a DB connection
$DB->connect();

//Load settings
	$CONFIG=array();
	$sql="select * from settings";
	$a=$DB->query($sql);
	while ($b=mysql_fetch_array($a))
	{
		$CONFIG[$b['setting_name']]=$b['setting_value'];
	}
	$CONFIG['allowed_mediatypes'] = str_replace(" ", "", $CONFIG['allowed_mediatypes']);
	$CONFIG['allowed_mediatypes_array'] = explode(",", $CONFIG['allowed_mediatypes']);
	$CONFIG['allowed_mediatypes_match'] = str_replace(",", "|", $CONFIG['allowed_mediatypes']);	
	$CONFIG['time_offset']=intval($CONFIG['time_offset'])*60*60;
	if (!$CONFIG['root_path'])
	{
		$CONFIG['root_path']=$_SERVER['DOCUMENT_ROOT']."/";
	}
	$CONFIG['root_path_dev']=substr($CONFIG['root_path'],0,-1);
	$sql="select * from country where id_country=".intval($CONFIG['id_country']);
	if ($country=mysql_fetch_array($DB->query($sql)))
	{
		$CONFIG['currency']=$country['currency'];
	}
//dat active=1 vao bien de don gian 
$sqlactive="active=1";
$act=$_GET['act'];
$idcat=intval($_GET['idcat']);
$id=intval($_GET['id']);
if ($act='news' && $idcat && $id)
{
	$sql="select * from news where id_cat=$idcat and id_news=$id and active=1";
	$xx=$DB->query($sql);
	if ($yy=mysql_fetch_array($xx))
	{
		$mainbody="<a href='javascript:window.close()'><img src='".$CONFIG['upload_image_path'].$yy['image']."' align='left' border='0' alt='Close'></a>";
	}

}
@mysql_close();
?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<title><?php echo $CONFIG['site_name']; ?></title>
	<link rel="stylesheet" href="style.css" type="text/css" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	</head>
	<body margin="0">
	<?php echo $mainbody; ?>
	</body>
	</html>
